package com.zc.Thread;

/**
 * @Auther: zhaocong
 * @Date: 2019/3/8 17:09
 * @Description:
 */
public class VolatileExample {
    private static volatile boolean isOver = false;

    public static void main(String[] args)  {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (!isOver) ;
            }
        });
        thread.start();
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        isOver = true;
    }
}
